SetItem(appleMenu,1,"\pAbout Pentominos..."); // Set the program name
// for first line of Apple menu
DoNewCommand();
}
void UpdateMenus(void) {
short i;
WindowPtr win;
xWindow *xwin;
win = FrontWindow();
if ( win && ((WindowPeek)win)->windowKind < 0 ) {
EnableItem(editMenu,1);
for (i=3; i<7; i++)
EnableItem(editMenu,i);
}
else {
DisableItem(editMenu,1);
for (i=3; i<7; i++)
DisableItem(editMenu,i);
}
if (win && xWindow::Window2XWindow(win,&xwin)) {
EnableItem(fileMenu,2);
}
else {
DisableItem(fileMenu,2);
}
}
void DoEditMenu(int itemNum) {
}
void DoFileMenu(int itemNum, int* done) {
xWindow *win;
if (itemNum == 4)
*done = 1;
else if (itemNum == 1)
DoNewCommand();
else if (itemNum == 2 && xWindow::Window2XWindow(FrontWindow(),&win))
win->Close();
}
void DoOtherMenu(int menuID, int itemNum) {
}
// ApplicaitonIdle sends the message playPiece to the first window on the
// list of open windows. (That window will in turn send the message on
// down the list, so that each window will have a chance to play one
// piece, each time ApplicationIdle is called.)
void ApplicationIdle(void) {
if (xWindowList) // check if the list is empty.
((myWindow*)xWindowList)->playPiece();
// The type cast is necessary since xWindowList is declared to be of type
// xWindow, not myWindow, and only myWindows have a function playPiece.
}
void CleanUpApplication(void) {
}
// Set up information about program for the About box:
void AboutBox(void) {
ParamText( "\pPentominos: An entertainment",
"\pDavid Eck",
"\pHobart and William Smith Colleges\rGeneva, NY 14456\rE-mail: eck@hws.bitnet",
"\pThis program tries to place the 12 pentominos (tiles that can be made with 5 squares) on an 8-by-8 board. Each tile is displayed with a different letter.");
Alert(128,0L);
}
void DoNewCommand(void) {
myWindow *pentWin;
WindowCt++; // count the windows that have been opened/
pentWin = new myWindow;
pentWin->Open("\pClick 4 Squares"); // initial title for window tells the